import 'package:equatable/equatable.dart';
import 'package:learning_content_admin_pannel.home.words/single_word_base_page/domain/entities/word_base_input.dart';

part 'result.dart';

abstract class UpdateWordBaseInputTitle {
  WordBaseInputTitleUpdateResult call({
    required String wordBaseInputTitleInputText,
    required WordBaseInput wordBaseInput,
  });
}

class UpdateWordBaseInputTitleImpl implements UpdateWordBaseInputTitle {
  const UpdateWordBaseInputTitleImpl();

  @override
  WordBaseInputTitleUpdateResult call({
    required String wordBaseInputTitleInputText,
    required WordBaseInput wordBaseInput,
  }) {
    final updatedWordBaseInput = wordBaseInput.copyWith(
      title: () => wordBaseInputTitleInputText,
    );

    final result = WordBaseInputTitleUpdateResult(
      wordBaseInput: updatedWordBaseInput,
    );

    return result;
  }
}
